﻿@{
    ViewBag.Title = "AddFirstype";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>AddFirstype</h2>
    <table>
        <tr>
            <td>添加第一类别名称为：<input id="Text1" type="text" /></td>
        </tr>
        <tr>
            <td><input id="Button1" type="button" value="添加" onclick="Add()" /></td>
        </tr>
    </table>
<script>
    function Add() {
        var name = $("#Text1").val();
        $.ajax({
            url: "/Home/Add_FirsType",
            type: "post",
            data: {
                name:name
            },
            success: function (data) {
                if(data=="1")
                {
                    alert('添加成功')
                    location.href = '/Home/Firstype_Show'
                }
                else
                {
                    alert('系统繁忙')
                }
            }
        })

    }
</script>